home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Documentation / DirectX9 / directx9_c.chm / directx / code / lookupres.js < prev    next >
Encoding:
Text File  |  2004-09-30  |  3.8 KB  |  173 lines

  1. <![CDATA[
  2.  
  3. // object used to hang onto the last retrieved xref/target data
  4. function CLookupResults() {}
  5.  
  6. CLookupResults.prototype.Init = function()
  7. {
  8.   this._href = "BADFOOD";
  9.   this._caption = "BADFOOD";
  10.  
  11. //  delete this._href;
  12. //  delete this._caption;
  13.  
  14.   delete this._item;
  15.   delete this._rid;
  16.   delete this._ionodes;
  17.   delete this._alinkproxy;
  18.   delete this._alink;
  19.   delete this._hxslink;
  20.   delete this._leave;
  21. }
  22.  
  23. // What's the href of the target underlying the xref
  24. CLookupResults.prototype.GetHREF = function()
  25. {
  26.   return this._href;
  27. }
  28.  
  29. CLookupResults.prototype.GetExtendedId = function(){
  30.     return this._extendedRid;
  31. }
  32.  
  33. // what's the caption of the target underly the xref?
  34. CLookupResults.prototype.GetCaption = function()
  35. {
  36.   return this._caption;
  37. }
  38.  
  39. // set the url corr. to the xref
  40. CLookupResults.prototype.SetHREF = function(s)
  41. {
  42.   return (this._href = s);
  43. }
  44.  
  45. // set the display name corresponding to the xref
  46. CLookupResults.prototype.SetCaption = function(s)
  47. {
  48.   if (s)
  49.     this._caption = s;
  50. }
  51.  
  52. // cache the js representation of the target
  53. CLookupResults.prototype.SetItem = function(sRID, oItem)
  54. {
  55.   this._rid = sRID;
  56.   this._item = oItem;
  57. }
  58.  
  59. // retrieve the js representation of the target
  60. CLookupResults.prototype.GetItem = function()
  61. {
  62.   if (this._item)
  63.       return this._item;
  64.   else
  65.       return null;
  66. }
  67.  
  68. // retrieve the id of the target
  69. CLookupResults.prototype.GetID = function()
  70. {
  71.   return this._rid;
  72. }
  73.  
  74. // retrieve the type of the target underly the xref
  75. CLookupResults.prototype.GetType = function()
  76. {
  77.   return this.GetItem()._type;
  78. }
  79.  
  80. // retrieve the persistent name of the target underly the xref
  81. CLookupResults.prototype.GetPersistentName = function(sAlternate)
  82. {
  83.   if (this.GetItem() && this.GetItem()._pn)
  84.     var sPN = this.GetItem()._pn;
  85.   else
  86.     var sPN = null;
  87.  
  88.   return (sPN ? sPN : sAlternate);
  89. }
  90.  
  91. // how many references to the current xref?
  92. CLookupResults.prototype.GetCount = function()
  93. {
  94.   return this.GetItem()._cRefs;
  95. }
  96.  
  97. // Does the count of references to the xref exceed iCount?
  98. CLookupResults.prototype.CountExceeds = function(iCount)
  99. {
  100.   return ((this.GetItem()._cRefs > iCount) ? true : false);
  101. }
  102.  
  103. //at: HXS-specific.
  104.  
  105. //at: Is media an HXS?
  106. CLookupResults.prototype.IsHxsLink = function()
  107. {
  108.   var bHxs = false;
  109.   var oCtx = goLookup._oCtx;
  110.   var sMedia = null;
  111.   //var oTNode = null;
  112.   //var sChm = "";
  113.   //var bOther = false;
  114.  
  115.   if (oCtx)
  116.   {
  117.     sMedia = oCtx._media;
  118.     //oTNode = oCtx._oTDom.firstChild;
  119.  
  120.     //if (oTNode && oTNode.nodeName == "targ")
  121.     // sChm = oTNode.getAttribute("chm");
  122.  
  123.     //if (sChm == "other")
  124.     //  bOther = true;
  125.  
  126.     //if (sMedia && sMedia == "hxs" && bOther)
  127.     //  bHxs = true;
  128.     if (sMedia && sMedia == "hxs" && this._hxslink)
  129.       bHxs = true;
  130.   }
  131.  
  132.   return (bHxs);
  133. }
  134.  
  135. //at: Get the hxs link?
  136. CLookupResults.prototype.GetHxsLink = function()
  137. {
  138.   // peterril: should not be used to create links.  
  139.   //           The tag is generated in stylesheets.
  140.   //return this._hxslink;
  141. }
  142.  
  143. // CHM-specific crud
  144.  
  145. CLookupResults.prototype.IsALink = function()
  146. {
  147.   return ((this._alink && this._alinkproxy)? true : false);
  148. }
  149.  
  150. CLookupResults.prototype.GetALink = function()
  151. {
  152.   return (this._alink ? this._alink : "");
  153. }
  154.  
  155. CLookupResults.prototype.GetALinkProxy = function()
  156. {
  157.   return (this._alinkproxy ? this._alinkproxy : "");
  158. }
  159.  
  160. // acceptable values for sLoc are 'chm' and 'ms'
  161. // Permanent targets (manually maintained links to external content) may include links to content outside of the company (ms).
  162. CLookupResults.prototype.LinkLeaves = function(sLoc)
  163. {
  164.   return (this._leave && this._leave.toLowerCase() == sLoc.toLowerCase() ? true : false)
  165. }
  166.  
  167. CLookupResults.prototype.IsPermTarg = function()
  168. {
  169.   return (this._item && this._item._perm ? true : false)
  170. }
  171.  
  172. ]]>
  173.